//
//  BCRouterProtocol.h
//  Pods
//
//  Created by Basic on 2018/11/3.
//

#ifndef BCRouterProtocol_h
#define BCRouterProtocol_h

@class BCRouter;
@class BCRouteRequest;

NS_ASSUME_NONNULL_BEGIN
#pragma mark - route 组件协议


@protocol  BCRouteProtocol <NSObject>
@optional

///**
// route 初始化，这里可以请求到页面映射表，手动完成注册。
//
// @param router router
// */
//- (void )bcrouteSetup:(BCRouter *)router;

/**
 route 将要push，这里可以做统一拦截
 
 @param router router
 @param request BCRouteRequest
 */
- (void )bcroute:(BCRouter *)router willPushRequest:(BCRouteRequest *)request;

@end


#pragma mark - route 页面协议
@protocol  BCRoutePageProtocol <NSObject>
@optional

/**
 获取自定义转场动画 实现（只支持present模式）
 
 @return return value description
 */
- (id<UIViewControllerTransitioningDelegate> _Nullable)zhroutePressentTransitioningDelegate;

/**
 获取自定义转场动画 实现（只支持dismiss模式）
 
 @return return value description
 */
- (id<UIViewControllerTransitioningDelegate> _Nullable)zhrouteDismissTransitioningDelegate;


/**
 route 将要push，返回值 标识是否可以push
 
 @param params route url 参数
 @param extData 扩展参数
 */
+ (BOOL )zhrouteWillPush:(NSDictionary *_Nullable)params extData:(NSDictionary *_Nullable)extData;

/**
 route 将要push，vc 已经初始化完成，等待验证是否可以push
 
 @param params route url 参数
 @param extData 扩展参数
 @param nextBlock 继续执行block
 */
- (void )zhrouteWillPush:(NSDictionary *_Nullable)params extData:(NSDictionary *_Nullable)extData withNextBlock:(void(^_Nullable)(BOOL canContinue) )nextBlock;


/**
 route page 重新加载
 
 @param params route url 参数
 @param extData 扩展参数
 */
- (void )zhroutePageReload:(NSDictionary *_Nullable)params extData:(NSDictionary *_Nullable)extData;
@end



/// web 协议
@protocol  BCRouteWebProtocol <NSObject>
@optional

/// web bridge 回传事件
/// - Parameters:
///   - router: router description
///   - name: name description
///   - body: body description
- (void )bcroute:(BCRouter *)router webBridg:(NSString *)name messageBody:(id)body;

@end
NS_ASSUME_NONNULL_END


#endif /* BCRouterProtocol_h */
